<template>
	<view>
		<button @click="optiong()">设置：{{egghot}}</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				egghot:123
			}
		},
		methods: {
			optiong(){
				uni.showModal({
					title: '提示',
					editable: true,
					placeholderText: '请输入10以内的正整数',
					success: res=>{
						if(res.confirm){
							res.content-=0;
							console.log(res.content);
							if(res.content<10&&res.content>=0){
								this.egghot=res.content;
								alert('设置成功');
							}
							else{
								console.log(typeof res.content);
								alert('请输入10以内的正整数');
							}
						}
						else if(res.cancel){
							console.log('用户点击取消');
						}
					}
				})
			}	
		}
	}
</script>

<style>
</style>